package com.autobet.services.thread;

import com.autobet.services.BetService;
import com.autobet.services.EnvConfigService;
import com.autobet.services.ResultService;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * Created by yangd on 2017-08-27.
 */
public class CheckSystemThread extends Thread {
    private static final Logger log = LoggerFactory.getLogger(CheckSystemThread.class);
    private long lSleepTime = 180000L;
    private static Map checkMap = new HashMap();

    public CheckSystemThread() {
    }

    public void run() {
        ResultService resultService = (ResultService) EnvConfigService.getApplicationContext().getBean(ResultService.class);
        BetService betService = (BetService) EnvConfigService.getApplicationContext().getBean(BetService.class);
        long var3 = 0L;

        while ("RUNING".equals(EnvConfigService.getTaskStatus())) {
            try {
                resultService.setAccountRpt();
            } catch (Exception var8) {
                ;
            }

            try {
                resultService.getMgr();
            } catch (Exception var7) {
                ;
            }

            try {
                Thread.sleep(this.lSleepTime);
            } catch (InterruptedException var6) {
                betService.stopBetForException("[系统预警]系统监控线程异常，请暂停系统，重新执行下单!");
                log.info("[系统预警]系统监控线程异常，请暂停系统，重新执行下单!");
                return;
            }
        }

        log.info("系统执行状态不正确，退出[系统健康检查任务]");
        resultService.addInfo("系统执行状态不正确，退出[系统健康检查任务]，请重新启动");
    }
}
